var mongoose=require("mongoose");

mongoose.connect("mongodb://localhost:27017/Info");

var db=mongoose.connection;

db.on("open",function(){
	console.log("数据库连接成功");
});
db.on("error",function(){
	console.log("数据连接失败");
})
var Schema=mongoose.Schema;

var userSchema = new Schema({
	username:String,
	email:String,
	password:String,
	gender:Boolean,
	createTime:Date
})

var users=mongoose.model("users",userSchema);

var CartsSchema = new Schema({
	mark:String,
	product:String,
	unitPrice:Number,
	price:Number,
	count:Number,
	picsrc:String,
})

var carts=mongoose.model("carts", CartsSchema);
//module.exports.users=users;
//module.exports.carts=carts;
module.exports={
					users:users,
					carts:carts
				};
